<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">

.submit_email_reg {
	background:#FFFFFF;
	padding:4px 4px 4px 2px;
	border:1px solid #97D3F5;
	width:230px;
	height:18px;
}
.password_email_reg {
	background:#FFFFFF;
	padding:4px 4px 4px 2px;
	border:1px solid #97D3F5;
	width:230px;
	height:18px;
}
.password_email {
	background:#FFFFFF url(images/pas_icn.gif) no-repeat 4px 4px;
	padding:4px 4px 4px 22px;
	border:1px solid #97D3F5;
	width:230px;
	height:18px;
}
.submit_email {
	background:#FFFFFF url(images/ema_icn.png) no-repeat 4px 4px;
	padding:4px 4px 4px 22px;
	border:1px solid #97D3F5;
	width:230px;
	height:18px;
}
.errTxt
{
	font: 9px/10px Georgia, "Times New Roman", Times, serif;
	color:red;
}
.login_hd {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:20px; border-bottom:#333333 1px dotted; font-weight:bold;}
.email_hd{padding-top:10px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; color:#1489CF; font-weight:bold;}
.email_hd_top{padding-top:10px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; color:#1489CF; font-weight:bold; border-bottom:#1489CF 4px solid;}
</style>
<script type="text/javascript" src="js/jquery-1.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function blankfields()
{
	 $("#txtFirstName").val("");
	 $("#txtLastName").val("");
	 $("#txtEmail").val("");
	 $("#txtPassword").val("");
	 $("#txtConfPassword").val("");
	 
}
//-->
</script>
</head>

<body style="padding:0; margin:0;" onload="MM_preloadImages('images/submit_img2.png');blankfields();">
<table width="580" border="0" align="center" cellspacing="0">
  <tr>
    <td colspan="2" align="center"><span class="login_hd">Registration Form</span></td>
  </tr>
  
  
  <tr>
    <td width="289" align="left" valign="top" style="border-right:#1489CF 1px dotted;">
	<form id="frmLogin" name="frmLogin" method="post" action="">
	<table width="250" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td colspan="2" align="left" valign="top" class="email_hd_top">Login</td>
      </tr>
      <tr>
        <td colspan="2" align="left" valign="top" class="email_hd">Email: &nbsp;<span id="errUname" class="errTxt"></span></td>
      </tr>
      <tr>
        <td colspan="2" align="left"><input type="text" size="40" name="txtLoginEmail" id="txtLoginEmail" class="submit_email"></td>
        </tr>
      <tr>
        <td colspan="2" align="left" valign="top" class="email_hd">Password: &nbsp;<span id="errPwd" class="errTxt"></span></td>
      </tr>
      <tr>
        <td colspan="2" align="left" valign="top"><input type="password" size="40" name="txtLoginPassword" id="txtLoginPassword" class="password_email" /></td>
        </tr>
      <tr>
        <td width="49%" style="padding-top:10px;">
        <img onclick="docheckLogin();" src="images/submit_img1.png" name="Image6" width="120" height="40" border="0" id="Image6" /></a></td>
        <td width="51%" rowspan="2"><br />
          <img src="images/reg_icn.png" alt="" width="128" height="128" /></td>
      </tr>
      <tr>
        <td style="padding-top:10px;">&nbsp;</td>
        </tr>
        
         <tr>
        <td colspan="2" align="left" valign="top">
		<span id="errLogin"></span>
		</td>
        </tr>
      <tr>
    </table>
	</form>
	</td>
    <td width="287" align="right" valign="top">
	<form id="frmRegister" name="frmRegister" method="" action="">
	<table width="250" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td colspan="2" align="left" valign="top" class="email_hd_top">Register</td>
      </tr>
      <tr>
        <td colspan="2" align="left" valign="top" class="email_hd">First name: &nbsp;<span id="errFname" class="errTxt"></span></td>
      </tr>
      <tr>
        <td colspan="2" align="left"><input type="text" size="40" name="txtFirstName" id="txtFirstName" class="submit_email_reg" /></td>
      </tr>
      <tr>
        <td colspan="2" align="left" class="email_hd">Last Name: &nbsp;<span id="errLname" class="errTxt"></span></td>
      </tr>
      <tr>
        <td colspan="2" align="left"><input type="text" size="40" name="txtLastName" id="txtLastName" class="submit_email_reg" /></td>
      </tr>
      <tr>
        <td colspan="2" align="left" class="email_hd">Email: &nbsp;<span id="errEmail" class="errTxt"></span></td>
      </tr>
      <tr>
        <td colspan="2" align="left"><input type="text" size="40" name="txtEmail" id="txtEmail" class="submit_email_reg" /></td>
      </tr>      
      <tr>
        <td colspan="2" align="left" valign="top" class="email_hd">Password: &nbsp;<span id="errPassword" class="errTxt"></span></td>
      </tr>
      <tr>
        <td colspan="2" align="left" valign="top"><input type="password" size="40" name="txtPassword" id="txtPassword" class="password_email_reg" /></td>
      </tr>
      <tr>
        <td colspan="2" align="left" valign="top" class="email_hd">Confirm Password: &nbsp;<span id="errCPassword" class="errTxt"></span></td>
      </tr>
      <tr>
        <td colspan="2" align="left" valign="top"><input type="password" size="40" name="txtConfPassword" id="txtConfPassword" class="password_email_reg" /></td>
      </tr>
      <tr>
        <td width="70%" style="padding-top:10px;">
		<img src="images/submit_img1.png" onclick="doCheckRegister()" name="Image6" width="120" height="40" border="0" id="Image6" /></a></td>
        <td width="30%">&nbsp;</td>
      </tr>
    </table>
	</form>
	</td>
  </tr>
</table>
<script>

	function docheckLogin()
	{
		var txtLoginEmail = $("#txtLoginEmail").val();
		var txtLoginPassword = $("#txtLoginPassword").val();
		var strErrMsg="";
		if(txtLoginEmail.length==0)
		{
			strErrMsg += "Login Email can not be blank.";
			strErrMsg+="\n";
		}
		if(txtLoginPassword.length==0)
		{
			strErrMsg += "Password can not be blank.";
			strErrMsg+="\n";
		}

		if(strErrMsg.length!=0)
		{
			alert(strErrMsg);
		}
		else
		{
			$.post("doLogin.php",{email:txtLoginEmail,password:txtLoginPassword},function (data){
				if(data==0)
				{
					alert("Invalid Username/Password");
					return false;
				}
				else
				{
					self.close();
					window.open("admin/admin-homepage.php");
				}
			},"text");
		}
	}


	function doCheckRegister()
	{
		var txtFirstName = $("#txtFirstName").val();
		var txtLastName = $("#txtLastName").val();
		var txtEmail = $("#txtEmail").val();
		var txtPassword = $("#txtPassword").val();
		var txtConfPassword = $("#txtConfPassword").val();

		var strErrMsg="";
		if(txtFirstName.length==0)
		{
			strErrMsg += "First name can not be blank.";
			strErrMsg+="\n";
		}
		if(txtLastName.length==0)
		{
			strErrMsg += "Last name can not be blank.";
			strErrMsg+="\n";
		}
		if(txtEmail.length==0)
		{
			strErrMsg += "Email can not be blank.";
			strErrMsg+="\n";
		}
		if(txtPassword.length==0)
		{
			strErrMsg += "Password can not be blank.";
			strErrMsg+="\n";
		}
		if(txtConfPassword.length==0)
		{
			strErrMsg += "Confirm Password can not be blank.";
			strErrMsg+="\n";
		}
		if(txtPassword!=txtConfPassword)
		{
			strErrMsg += "Password do not match.";
			strErrMsg+="\n";
		}
		if(strErrMsg.length!=0)
		{
			alert(strErrMsg);
		}
		else
		{
			$.post("doRegister.php",{fName:txtFirstName,lName:txtLastName,email:txtEmail,password:txtPassword},function (data){
				if(data==1)
				{
					alert("Thanks for registering with us.");
				}
				else
				{
					alert("There was a problem while registering. please try again later.");
				}
			},"text");
		}
	}

</script>


</body>
</html>
